package org.sith.taskrunner.gwt.client.widgets;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;


public class TabHeader extends Composite{
    interface TabHeaderUiBinder extends UiBinder<HorizontalPanel, TabHeader> {
    }

    private static TabHeaderUiBinder ourUiBinder = GWT.create(TabHeaderUiBinder.class);
    @UiField
    Button closeButton;
    @UiField
    Label tabTitle;

    private int tabIndex;

    public TabHeader() {
        initWidget(ourUiBinder.createAndBindUi(this));
    }


    public void setTabTitle(String tabName){
        tabTitle.setText(tabName);
    }

    public void setTabCloseListener(ClickHandler handler) {
        closeButton.addClickHandler(handler);
    }

    public void setEnabled(boolean enabled){
        closeButton.setEnabled(enabled);
    }

}